<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<link rel="stylesheet" href="assets/layui/css/layui.css">
<body style="margin: 50px">
<div class="layui-input-inline">
    <input type="text" class="layui-input" id="rangetimes"  placeholder="开始日期 - 截至日期">
</div>
<table class="layui-hide" id="test" lay-filter="test"></table>
</body>
<script type="text/javascript" src="assets/layui/layui.js"></script>
<script type="text/javascript" src="assets/jquery.min.js"></script>
<script>
    var table
    layui.use(['table','layer','laydate'], function(){
        table = layui.table;
        laydate = layui.laydate;
        laydate.render({
            elem: '#rangetimes'
            ,type: 'datetime'
            ,range: true
            ,done:function (value, date, endDate) {

                var ftime = '';
                var ltime = '';
                if (value!=null&&value!=''){
                    ftime = value.split(" - ")[0]
                    ltime = value.split(" - ")[1]
                }
                showtable(ftime,ltime)
            }
        });
        showtable()


       function showtable(ftime,ltime) {

           table.render({
               elem: '#test'
               ,url:'/api/v1/temp/showbyid'
               ,toolbar: true
               ,title: '学生体温信息表'
               ,totalRow: true
               ,cols: [[
                   {field:'id', title:'ID', fixed: 'left', unresize: true, sort: true}
                   ,{field:'name', title:'用户名', edit: 'text'}
                   ,{field:'temp', title:'体温', edit: 'text',sort: true}
                   ,{field:'time', title:'时间', edit: 'text',sort: true}

               ]]
               ,page: true
               ,response: {
                   statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
               }
               ,where:{
                   "ftime":ftime,
                   "ltime":ltime,
               }
              /* ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
                   return {
                       "code": res.status, //解析接口状态
                       "msg": res.message, //解析提示文本
                       "count": res.total, //解析数据长度
                       "data": res.rows.item //解析数据列表
                   };
               }*/
           });
       }
    });
</script>
</html>